﻿using MenuService.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

namespace MenuService.Permissions;

public class MenuServicePermissionDefinitionProvider : PermissionDefinitionProvider
{
    public override void Define(IPermissionDefinitionContext context)
    {
        //var myGroup = context.AddGroup(MenuServicePermissions.GroupName, L("Permission:MenuService"));
        var productManagementGroup = context.AddGroup(MenuServicePermissions.GroupName, L("MenuService"));

        var products = productManagementGroup.AddPermission(MenuServicePermissions.Menu.Default, L("MenuService.Menu"));
        products.AddChild(MenuServicePermissions.Menu.Update, L("MenuService.Menu.Edit"));
        products.AddChild(MenuServicePermissions.Menu.Delete, L("MenuService.Menu.Delete"));
        products.AddChild(MenuServicePermissions.Menu.Create, L("MenuService.Menu.Create"));
    }



    private static LocalizableString L(string name)
    {
        return LocalizableString.Create<MenuServiceResource>(name);
    }
}
